//
//  ZJModelTool.m
//  MyDamaiProject
//
//  Created by quiet on 15/5/28.
//  Copyright (c) 2015年 quiet. All rights reserved.
//

#import "ZJModelTool.h"

@implementation ZJModelTool

//代码创建model类
+ (void)createModelWithDictionary:(NSDictionary *)dict modelName:(NSString *)modelName {
  printf("\n#import \"BussinessModel.h\"\n");
  printf("\n@interface %s :BussinessModel\n", modelName.UTF8String);
  for (NSString *key in dict) {
    //NSString *type = ([dict[key] isKindOfClass:[NSNumber class]]) ? @"NSNumber" : @"NSString";
    //printf("@property (nonatomic,copy) %s *%s;\n", type.UTF8String, key.UTF8String);

    if (([dict[key] isKindOfClass:[NSNumber class]])) {
      NSString *type = @"NSInteger";
      printf("@property (nonatomic,assign) %s %s;\n", type.UTF8String, key.UTF8String);
    } else {
      NSString *type = @"NSString";
      printf("@property (nonatomic,strong) %s *%s;\n", type.UTF8String, key.UTF8String);
    }
  }
  printf("@end\n");
}

@end
